package {
	import flash.text.TextFormat;
	import flash.text.TextField;
	import flash.display.Sprite;


	public class Toolbar extends Sprite {
		private var myScore:TextField;
		private var myTime:TextField;
		private var myCoins:uint = 0;
		private var mySecs:uint = 90;
		private var myFormat:TextFormat = new TextFormat();

		
		public function Toolbar() {
			drawToolbar();
			setFormat();
			putScore();
			putTime();
			putOptionPause();
			putOptionSound();
		}
		private function putOptionSound():void{
			var sound:TextField = new TextField();
			sound.defaultTextFormat = myFormat;
			sound.x = 630;
			sound.y = 20;
			sound.width = 150;
			sound.text = 'S : Sonido off/on';
			addChild(sound);
		}
		private function putOptionPause():void{
			var pause:TextField = new TextField();
			pause.defaultTextFormat = myFormat;
			pause.x = 633;
			pause.y = 0;
			pause.width = 150;
			pause.text = 'P : Pausa/Resumir';
			addChild(pause);
		}
		private function putScore():void{
			myScore = new TextField();
			myScore.defaultTextFormat = myFormat;
			myScore.width = 150;
			myScore.text = 'Monedas: ' + myCoins.toString();
			myScore.x = 10;
			addChild(myScore);
		}
		private function putTime():void{
			myTime = new TextField();
			myTime.defaultTextFormat = myFormat;
			myTime.width = 150;
			myTime.x = 400;
			myTime.text = 'Tiempo: ' + mySecs.toString();
			addChild(myTime);
		}
		private function drawToolbar():void{
			graphics.beginFill(0xffffff);
			graphics.drawRect(0, 0, 800, ScreenGame.PIXEL_SIZE/2);
			graphics.endFill();
		}
		private function setFormat():void{
			myFormat.color=0x000000;
			myFormat.size = 16;
			myFormat.align = 'left';
			myFormat.font = 'Comic sans MS';
		}
		public function get score():TextField{
			return myScore;
		}
		public function set score(value:TextField):void{
			myScore = value;
		}
		public function get points():uint{
			return myCoins;
		}
		public function set points(value:uint):void{
			myCoins = value;
		}
		public function get secs():uint{
			return mySecs;
		}
		public function set secs(value:uint):void{
			mySecs = value;
		}
		public function get time():TextField{
			return myTime;
		}
		public function set time(value:TextField):void{
			myTime = value;
		}
		public function get format():TextFormat{
			return myFormat;	
		}

		
	}
}
